import socket 

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
addr = ('192.168.2.3', 3000)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind(addr)
print 'bind on port: ', 3000
sock.listen(5)

while True:
  conn, address=sock.accept() 
  print 'accept a connect from', address
  while True:
    buff=conn.recv(8192)
    if len(buff) ==0:
      break;
    print "".join(["\'\\x%02X\', " % ord(k) for k in buff])
  conn.close()
